package com.yunjie.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "user_info", catalog = "new_manage")
public class UserInfo implements java.io.Serializable {
	private static final long serialVersionUID = 561930648033635074L;
	private Integer id;
	private String name;
	private String loginName;
	private String password;
	private String number;
	private String gender;
	private String mobile;
	private String phone;
	private String email;
	private String isStop;
	private Set<NewsInfo> newsInfos = new HashSet<NewsInfo>(0);

	public UserInfo() {
	}

	public UserInfo(String name, String loginName, String password,
			String number, String gender, String mobile) {
		this.name = name;
		this.loginName = loginName;
		this.password = password;
		this.number = number;
		this.gender = gender;
		this.mobile = mobile;
	}

	public UserInfo(String name, String loginName, String password,
			String number, String gender, String mobile, String phone,
			String email, String isStop, Set<NewsInfo> newsInfos) {
		this.name = name;
		this.loginName = loginName;
		this.password = password;
		this.number = number;
		this.gender = gender;
		this.mobile = mobile;
		this.phone = phone;
		this.email = email;
		this.isStop = isStop;
		this.newsInfos = newsInfos;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name", nullable = false, length = 25)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "login_name", nullable = false, length = 16)
	public String getLoginName() {
		return this.loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	@Column(name = "password", nullable = false, length = 16)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "number", nullable = false, length = 16)
	public String getNumber() {
		return this.number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	@Column(name = "gender", nullable = false, length = 5)
	public String getGender() {
		return this.gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	@Column(name = "mobile", nullable = false, length = 11)
	public String getMobile() {
		return this.mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	@Column(name = "phone", length = 12)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "email", length = 50)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "is_stop", length = 5)
	public String getIsStop() {
		return this.isStop;
	}

	public void setIsStop(String isStop) {
		this.isStop = isStop;
	}

	@OneToMany(targetEntity = NewsInfo.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "userInfo")
	public Set<NewsInfo> getNewsInfos() {
		return this.newsInfos;
	}

	public void setNewsInfos(Set<NewsInfo> newsInfos) {
		this.newsInfos = newsInfos;
	}

}